package rest.jbpm.wrappers;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import rest.jbpm.identity.ExtendedGroup;
import rest.jbpm.services.DNC14N;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "group", propOrder = {
    "id",
    "name",
    "type",
    "uuid"
})
public class Group {
	
	private String id;
	private String name;
	private String type;
    private String uuid;

	public Group() {
		
	}
	
	public Group(org.jbpm.api.identity.Group grp) {
		this.id = DNC14N.c14n(grp.getId());
		this.name = grp.getName();
		this.type = grp.getType();
        if(grp instanceof ExtendedGroup)
            this.uuid = ((ExtendedGroup)grp).getUuid();
	}
	
	@XmlElement(required = true)
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	@XmlElement(required = false)
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@XmlElement(required = false)
	public String getType() {
		return type;
	}
	
	public void setType(String type) {
		this.type = type;
	}

    @XmlElement(required = false)
    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

}
